<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

class ChannelAction extends BaseAction {
	// 检查用户是否登录
/*	var $cato = array();
	var $cato_result = array();*/
	var $url = "__APP__/Channel";
	
	
/*	function CategroyAction(){

	}*/

	function index(){
		$this->assign('channel_list',d('channel')->select());	
		$this->display("channel:channel");
		
	}
	
	function channel_add(){
		if($_POST['chl_add']){
			$chl['chid'] = $_POST['chid'];
			$chl['name'] = $_POST['name'];
			if(d('channel')->add($chl)){
				$msg="频道添加成功";				
			}
			else{
				$msg="频道添加失败";				
			}
			$this->assign('jumpUrl',$this->url); 
			$this->success($msg);
			
		}
		else{
			$this->display("channel:channel_add");
		}
	}
    
}
?>